all: libsample.so use_sample_so.out

use_sample_so.out: use_sample_so.o libsample.so
	gcc use_sample_so.o -o use_sample_so.out -L. -lsample -lm

libsample.so: sample.h sample.lo
	gcc -shared sample.lo -o libsample.so

sample.lo: sample.c sample.h
	gcc -c -fpic sample.c -o sample.lo

use_sample_so.o: use_sample_so.c sample.h
	gcc -c use_sample_so.c

.PHONY : clean
clean:
	-rm *.out *.so *.lo *.o
